using System;
using System.Collections.Generic;
using System.Text;

namespace PeDALS.Tools.AZ.PSTArchive.PSTData
{
    public class NameEntry
    {
        private UInt32 m32PropertyID;
        private UInt16 m16GUID;
        private UInt16 m16PropertyIndex;
        private List<Guid> mlgGUID;

        public NameEntry(UInt32 u32PropertyID, UInt16 u16GUID, UInt16 u16PropertyIndex, List<Guid>lgGUID)
        {
            m32PropertyID = u32PropertyID;
            m16GUID = u16GUID;
            m16PropertyIndex = u16PropertyIndex;
            mlgGUID = lgGUID;
        }

        public UInt32 PropertyID
        {
            get { return m32PropertyID; }
        }

        public bool NamedProperty
        {
            get { return Convert.ToBoolean(m16GUID & 0x1); } 
        }

        public UInt16 GUIDIndex
        {
            get { return (UInt16)(m16GUID >> 1); } // >> (UInt16)1; }
        }

        public Guid GUIDValue
        {
            get
            {
                Guid gReturn;
                switch (GUIDIndex)
                {
                    case 0:
                        gReturn = new Guid("00000000-0000-0000-0000-000000000000");
                        break;
                    case 1:
                        gReturn = new Guid("00020328-0000-0000-C000-000000000046");
                        break;
                    case 2:
                        gReturn = new Guid("00020329-0000-0000-C000-000000000046");
                        break;
                    default:
                        gReturn = mlgGUID[GUIDIndex - 3];
                        break;
                }
                return gReturn;
            }
        }
        public UInt16 PropertyIndex
        {
            get { return (UInt16)(m16PropertyIndex + 0x8000); }
        }
    }
}
